package com.ai.networking.websocket.service.util;


import com.ai.networking.websocket.service.entity.WSMessage;
import com.alibaba.fastjson.JSON;

import javax.websocket.EncodeException;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;

public class MessageEncoder implements Encoder.Text<WSMessage> {


    @Override
    public String encode(WSMessage wsMessage) throws EncodeException {
        return JSON.toJSONString(wsMessage);
    }

    @Override
    public void init(EndpointConfig endpointConfig) {

    }

    @Override
    public void destroy() {

    }
}